package com.experience.yledu.insert;

import java.io.File;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;

import org.apache.tools.ant.Project;
import org.apache.tools.ant.taskdefs.SQLExec;
import org.apache.tools.ant.types.EnumeratedAttribute;


public class insert {
	

	
 //	private static final String URL = "jdbc:mysql://127.0.0.1:3306/piano";
//	private static final String USER = "root";
//	private static final String PASSWORD = "root";
		
	
	/*public static void main(String[] args) throws SQLException {

		try {
			Class.forName("com.mysql.jdbc.Driver");
			DriverManager.getConnection(URL,USER,PASSWORD);
			Connection con = DriverManager.getConnection(URL, USER, PASSWORD);
			Statement stat = con.createStatement();
			ResultSet rs = stat.executeQuery("select id,iphone from p_user");
			while(rs.next()){
				System.out.println(rs.getString("id")+","+rs.getString("iphone"));
			}
			
		} catch (ClassNotFoundException e1) {
			e1.printStackTrace();
		}
	}*/
	
	
		public static SQLExec sqlExec = new SQLExec();
	public static void main(String[] args) {
		
		System.currentTimeMillis();
		sqlExec.setDriver("com.mysql.jdbc.Driver");
		sqlExec.setUrl("jdbc:mysql://116.62.244.135:3306/qsdb");
		sqlExec.setUserid("root");
		sqlExec.setPassword("root");
		sqlExec.setSrc(new File("F://words1.sql"));
		sqlExec.setPrint(true); //设置是否输出
		//输出到文件 sql.out 中；不设置该属性，默认输出到控制台
//		sqlExec.setOutput(new File("src/sql.out"));
		sqlExec.setProject(new Project()); // 要指定这个属性，不然会出错   
		sqlExec.execute(); 
		System.currentTimeMillis();
		
		
//		insert ss = new insert();
//		Thread t1 = new Thread(ss, "线程1"); 
//		Thread t2 = new Thread(ss, "线程2"); 
//		Thread t3 = new Thread(ss, "线程3"); 
//		t1.start();
//		t2.start();
//		t3.start();
		
	}

}
